import { successResponse, errorResponseSchema } from './common.doc';

export const publicDocs = {
    code: {
        post: {
            summary: '请求验证码',
            description: '根据用户邮箱发送验证码',
            tags: ['公共接口'],
            requestBody: {
                required: true,
                content: {
                    'application/json': {
                        schema: {
                            type: 'object',
                            properties: {
                                email: {
                                    type: 'string',
                                    description: '用户邮箱，用于接收验证码'
                                },
                                type: {
                                    type: 'string',
                                    description: '验证码类型',
                                    enum: ['register', 'update_password']
                                }
                            }
                        }
                    }
                }
            },
            responses: {
                200: successResponse({}),
                400: {
                    description: '邮箱格式错误或邮箱已注册',
                    content: {
                        'application/json': {
                            schema: {
                                type: 'object',
                                properties: {
                                    code: {
                                        type: 'integer',
                                        description: '状态码'
                                    },
                                    success: {
                                        type: 'boolean',
                                        description: '是否成功'
                                    },
                                    message: {
                                        type: 'string',
                                        description: '错误信息'
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    upload: {
        post: {
            summary: '上传文件',
            description: '上传用户头像文件',
            tags: ['公共接口'],
            requestBody: {
                required: true,
                content: {
                    'multipart/form-data': {
                        schema: {
                            type: 'object',
                            properties: {
                                avatar: {
                                    type: 'string',
                                    format: 'binary',
                                    description: '用户头像'
                                }
                            }
                        }
                    }
                }
            },
            responses: {
                200: successResponse({
                    type: 'object',
                    properties: {
                        url: {
                            type: 'string',
                            description: '文件访问URL'
                        }
                    }
                }),
                400: errorResponseSchema
            }
        }
    }
}; 